{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 0,
   "metadata": {
    "colab": {},
    "colab_type": "code",
    "id": "ycLebpDnp1pX"
   },
   "outputs": [],
   "source": [
    "import itertools"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 0,
   "metadata": {
    "colab": {},
    "colab_type": "code",
    "id": "JzjdWAajp-k4"
   },
   "outputs": [],
   "source": [
    "players = ['White', 'Black']\n",
    "turns = itertools.cycle(players)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 35
    },
    "colab_type": "code",
    "id": "4a6_YMOBqBoa",
    "outputId": "a108e2e4-30ff-4568-f526-453c349724b1"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['White', 'Black', 'White', 'Black', 'White', 'Black', 'White', 'Black', 'White', 'Black']\n"
     ]
    }
   ],
   "source": [
    "countdown = itertools.count(10, -1)\n",
    "print([turn for turn in itertools.takewhile(lambda x:next(countdown)>0, turns)])"
   ]
  }
 ],
 "metadata": {
  "colab": {
   "name": "Exercise10.ipynb",
   "provenance": [],
   "version": "0.3.2"
  },
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
